package com.example.hangzhou.welbeing.mytestdemoapp.factory;

import android.support.v4.app.Fragment;

import com.example.hangzhou.welbeing.mytestdemoapp.fragment.AlphaFragment;
import com.example.hangzhou.welbeing.mytestdemoapp.fragment.RotateFragment;
import com.example.hangzhou.welbeing.mytestdemoapp.fragment.ScaleFragment;
import com.example.hangzhou.welbeing.mytestdemoapp.fragment.SetFragment;
import com.example.hangzhou.welbeing.mytestdemoapp.fragment.TranslateFragment;

import java.util.HashMap;

/**
 * 杭州惟君医疗科技有限公司09
 * Created by 20433 on 2018/5/8
 *
 * @desc 东风山河绿，春已不折柳，繁花看不尽，处处惹人留
 * @desc 佛祖镇楼，bug辟容易
 */

public class TraditionalAnimationFragmentFactory  {

    private static final int ALPHA = 0;
    private static final int TRANSLATE = 1;
    private static final int SCALE = 2;
    private static final int ROTATE = 3;
    private static final int SET = 4;
    private static HashMap<Integer, Fragment> mapAll = new HashMap();
    public static Fragment CreateCircleObject(int position) {
        Fragment fragment = mapAll.get(position);
        if (fragment == null) {
            switch (position) {
                case ALPHA:
                    fragment = new AlphaFragment();
                    break;
                case TRANSLATE:
                    fragment = new TranslateFragment();
                    break;
                case SCALE:
                    fragment = new ScaleFragment();
                    break;
                case ROTATE:
                    fragment = new RotateFragment();
                    break;
                case SET:
                    fragment = new SetFragment();
                    break;
            }
            mapAll.put(position, fragment);
            return fragment;
        }
        return fragment;
    }
}
